package com.hup.utils.swing.customView.viewTable2;

import lombok.Getter;

import java.awt.Color;

/**
 * @author hugan
 * @date 2024/6/15
 */
public abstract class VCellColorHandler<R> {

    @Getter
    private Color background;
    @Getter
    private Color foreground;

    public boolean setBack(Color color) {
        background = color;
        foreground = null;
        return true;
    }

    public boolean setFore(Color color) {
        background = null;
        foreground = color;
        return true;
    }

    public boolean setAll(Color back, Color fore) {
        background = back;
        foreground = fore;
        return true;
    }

    /**
     * 设置 background和foreground
     *
     * @param row modelIndex
     * @return needSet: true-需要设置color
     * @apiNote 更新数据后, 调用 table.repaint(); 刷新界面
     */
    public abstract boolean prepareColor(R rowData, boolean isSelected, boolean hasFocus, int row, int column);

}
